/* 
 * File:   player_main.cpp
 * Author: TELKOM-CIS
 *
 * Created on 05 Maret 2011, 14:00
 */

#include <iostream>
#include <conio.h>
#include "player.h"
#include "parser.h"

using namespace std;

/*
 * 
 */
int main(int argc, char** argv)
{
    int x, y;
    string name;
    player user;
    //Parser P1;
/*  cout<< "set current position:\n";
    cout<< "    x : "; cin>> x;
    cout<< "    y : "; cin>> y;
    cout<< "  face: 0. left\n        1. right\n        2. up\n        3. down\n";
    cout<< "  face: "; cin>> face;
    user.setpos(x,y);
    user.setFace(face); */
    
    /****************************/
    /*  Static Initialization   */
    /****************************/
    user.setName("Edgar");
    user.setAP(500);
    user.setpos(4,4);
    user.setFace(1);
    user.setMoney(2000);
    user.displaypos();

    field * Farm = new field(); cout<< "Create Farm\n";
    Farm->InsertObject(new Cabai(),4,5); cout<< "Create Cabai\n";
    user.water(Farm);
    cout<<Farm->getObject(4,5)->getObjectType()<<endl;

    user.inventory1.push_back(new BuahCabai());
    user.inventory1.push_back(new BuahCabai());
    cout<< "Add cabai to inventory1\n";
    user.inventory3.push_back(new BuahWortel());
    cout<< "Add wortel to inventory3\n";
    user.displayInventory();

    cout<< "Current AP: " << user.getAP() << endl;
    user.eat(3);
    cout<< "Eat wortel, current AP: " << user.getAP() << endl;
    user.setArea(2);
    cout<< "Set area = store\n";
    cout<< "Money: " << user.getMoney() << endl;
    user.buy(4,10);
    cout<< "Money: " << user.getMoney() << endl;
    //user.inventory2.push_back(new BuahMangga());
    //cout<< "Add mangga to inventory2\n";

    user.displayInventory();
    /****************/
    /*  Test walk N */
    /****************/
    //user.walk(1,10);
    //user.displaypos();
    //system("cls");
    //user.screenPos();
    /*
    do{
        gotoxy(40,0); cout<< "AP :" << user.getAP();
        gotoxy(40,1); cout<< user.getName();
        user.move(); //user.move();
        //P.setFace(face);
        //P.displaypos();

        //system("cls");
        user.screenPos();

    } while (user.getAP() >= 0); */
    delete Farm;
    return 0;
}